<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <?php $this->load->view('user/_html_head') ?>  
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
  </head>
  <body>
    <div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() { FB.init({appId: '289823484465602', status: true, cookie: true, xfbml: true}); };
      (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
        document.getElementById('fb-root').appendChild(e);
      }());
      
      (function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=289823484465602";
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));
    </script>
    <div class="wrapper_screen">
      <div class="wrapper_main">
        <?php $this->load->view('user/_header') ?>
        <div class="contenu">                
          <script type="text/javascript">
            <?php foreach ($promotions as $promotion) { ?>
              var time_<?php echo $promotion['id'] ?> = <?php echo $promotion['end_date'] - time() ?>;
              jQuery(document).ready(function(){
                $('#slideshow_<?php echo $promotion['id'] ?>').cycle({fx: 'fade'});
              });
            <?php } ?>
            jQuery(document).ready(function(){                
              setInterval(function() {
            <?php foreach ($promotions as $promotion) { ?>
                  setTimeAuction( "#remain_time_<?php echo $promotion['id'] ?>" , time_<?php echo $promotion['id'] ?> );
                  time_<?php echo $promotion['id'] ?> -= 1;
            <?php } ?>
              }, 1000);              
            });
          </script>
          <div style="float: left;width: 762px">
            <?php foreach ($promotions as $i => $promotion) { 
              $this->load->view('user/_promotions', array('promotion' => $promotion, 'i' => $i));
              } ?>
            <div class="paging_page" style="width: 100%;float:left"><?php echo $paging ?></div>
          </div>
          <?php echo $this->load->view('user/_right_index') ?>          
        </div>        
      </div>
    </div>
    <?php echo $this->load->view('user/_footer') ?>    
  </body>
</html>
